home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1988-08-16 | 3.2 KB | 99 lines |
- DEFINITION MODULE KermMisc;
- (************************************************************************)
- (* This Module contains several service routines *)
- (* written: 08.10.85 Matthias Aebi *)
- (* last modification: 13.03.86 Matthias Aebi *)
- (************************************************************************)
-
- FROM KermParam IMPORT Packet;
-
- EXPORT QUALIFIED ClrScr, GotoXY, SendChar, RecvChar, SendBreak, WriteChar,
- InitPort, SetBaud, ReadChar, AddBits, BitAND, BitOR,
- BitXOR, PrtErrPacket, ToChar, UnChar, Ctl, IncPackNum,
- DecPackNum, ReadString, DispInit, DispFile, DispTry,
- DispPack, DispMsg, StringToCard, CardToString;
-
- PROCEDURE ClrScr;
- (* Clear Screen / Window and position cursor in upper left corner *)
-
- PROCEDURE GotoXY(x,y: INTEGER);
- (* Move cursor to position x,y on the screen / working window *)
-
- PROCEDURE SendChar(ch: CHAR; portNr: CARDINAL);
- (* Send ch trough specified port *)
-
- PROCEDURE RecvChar(VAR ch: CHAR; portNr: CARDINAL): BOOLEAN;
- (* Receve ch from specified port. Busy read, TRUE if got char *)
-
- PROCEDURE ReadChar(VAR ch: CHAR): BOOLEAN;
- (* Receive ch from console. Busy read, TRUE if got char *)
-
- PROCEDURE ReadString(VAR s: ARRAY OF CHAR);
- (* Receive a string from console (terminated by CR) *)
- (* Return empty string if ESC was pressed *)
-
- PROCEDURE InitPort(portNr: CARDINAL);
- (* Init specified port *)
-
- PROCEDURE SetBaud(baudRate: CARDINAL; portNr: CARDINAL);
- (* Set baudRate on specified port *)
-
- PROCEDURE SendBreak(portNr: CARDINAL);
- (* Send a Break through specified port *)
-
- PROCEDURE WriteChar(ch: CHAR);
- (* Write ch and ORD(ch). Control characters are prefixed by ^ *)
-
- PROCEDURE AddBits(ch: CHAR): CARDINAL;
- (* Count the number of 1-Bits in Character (needed for Parity) *)
-
- PROCEDURE BitAND(v1,v2: CARDINAL): CARDINAL;
- (* AND Bits in v1 and v2 *)
-
- PROCEDURE BitOR(v1,v2: CARDINAL): CARDINAL;
- (* OR Bits in v1 and v2 *)
-
- PROCEDURE BitXOR(v1,v2: CARDINAL): CARDINAL;
- (* XOR Bits in v1 and v2 *)
-
- PROCEDURE PrtErrPacket(pack: Packet; len: CARDINAL);
- (* print the error message received *)
-
- PROCEDURE ToChar(value: CARDINAL): CHAR;
- (* convert number to printable ASCII *)
-
- PROCEDURE UnChar(ch: CHAR): CARDINAL;
- (* convert printable ASCII to number *)
-
- PROCEDURE Ctl(ch: CHAR): CHAR;
- (* make control character printable & reverse *)
-
- PROCEDURE IncPackNum(packNum: CARDINAL): CARDINAL;
- (* return (packNum + 1) MOD 64 *)
-
- PROCEDURE DecPackNum(packNum: CARDINAL): CARDINAL;
- (* return (packNum - 1) MOD 64 *)
-
- PROCEDURE DispInit;
- (* initialize Send / Recv status display Screen *)
-
- PROCEDURE DispTry;
- (* Display total number of retries and increment by one *)
-
- PROCEDURE DispPack;
- (* Display total number of packets and increment by one *)
-
- PROCEDURE DispFile(fileName: ARRAY OF CHAR);
- (* Display the current Filename *)
-
- PROCEDURE DispMsg(message: ARRAY OF CHAR);
- (* Display a message in the status screen *)
-
- PROCEDURE StringToCard(str: ARRAY OF CHAR; VAR num: CARDINAL): BOOLEAN;
- (* convert a numeric string to cardinal. Return TRUE if successful *)
-
- PROCEDURE CardToString(num: CARDINAL; VAR str: ARRAY OF CHAR);
- (* convert a cardinal to a numeric string. Return TRUE if successful *)
-
- END KermMisc.
-